//封装本地存储存储数据与读取数据方法
//存储数据
export const SET_TOKEN = (token: string) => {
  localStorage.setItem('TOKEN', token)
}
//本地存储获取数据
export const GET_TOKEN = () => {
  return localStorage.getItem('TOKEN')
}
//本地存储删除数据方法
export const REMOVE_TOKEN = () => {
  localStorage.removeItem('TOKEN')
}
// 获取localStorage
export function getLocalStorage(key: string) {
  const value = localStorage.getItem(key)
  if (typeof value === 'string') {
    return JSON.parse(value)
  } else {
    return undefined
  }
}
// 设置localStorage
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function setLocalStorage(key: string, value: any) {
  return localStorage.setItem(key, JSON.stringify(value))
}
// 移除localStorage
export function delLocalStorage(key: string) {
  return localStorage.removeItem(key)
}
